package com.jsu.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jsu.bean.FoundDetail;
import com.jsu.bean.FoundMessage;
import com.jsu.dao.FoundMapper;
import com.jsu.dao.FoundMessageMapper;

@Component
public class RecieveFoundService {

	@Autowired
	FoundMapper foundMapper;
	@Autowired
	FoundMessageMapper foundMessageMapper;
	
	public void recieveFound(FoundDetail foundDetail){
		System.out.println(foundDetail.getFound());
		foundMapper.insertSelective(foundDetail.getFound());
		for(FoundMessage foundMessage:foundDetail.getFoundMessages()){
			foundMessage.setFoundId(foundDetail.getFound().getFoundId());
			foundMessageMapper.insertSelective(foundMessage);
		}
	}
}
